<%@ page language="java" import="com.google.gson.Gson" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ page import="up7.biz.PathGuidBuilder" %>
<%@ page import="up7.biz.up7_biz_event" %>
<%@ page import="up7.model.FileInf" %>
<%@ page import="up7.utils.PathTool" %>
<%@ page import="java.io.File" %>
<%
    out.clear();
    /*
        更新记录：
            2023-03-01 创建
    */
    String id 		= request.getParameter("id");
    String pathLoc 	= request.getParameter("pathLoc");
    String sizeLoc 	= request.getParameter("sizeLoc");
    String lenLoc 	= request.getParameter("lenLoc");
    String uid 		= request.getParameter("uid");
    String fCount	= request.getParameter("filesCount");
    String callback = request.getParameter("callback");
    pathLoc			= PathTool.url_decode(pathLoc);


    File ps            = new File(pathLoc);
    FileInf f          = new FileInf();
    f.nameLoc          = ps.getName();
    f.nameSvr          = f.nameLoc;
    f.id               = id;
    f.pathLoc          = pathLoc;
    f.sizeLoc          = sizeLoc;
    f.lenLoc           = Long.parseLong(lenLoc);
    f.fileCount        = Integer.parseInt(fCount);
    f.fdTask           = true;
    f.uid              = uid;

    //生成路径
    PathGuidBuilder pb = new PathGuidBuilder();
    f.pathSvr          = pb.genFolder(f.uid, f.id, f.nameLoc);
    f.pathSvr          = f.pathSvr.replace("\\","/");//服务器全部使用反斜杠
    PathTool.mkdir(f.pathSvr);

    //触发事件
    up7_biz_event.folder_create(f);

    Gson gson   = new Gson();
    String json = gson.toJson(f);
    json        = PathTool.url_encode(json);
    json        = callback + "({\"value\":\"" + json + "\"})";//返回jsonp格式数据。
    out.write(json);
%>